<?php
/**
 * Created by PhpStorm.
 * User: sykbxc
 * Date: 2019/1/20
 * Time: 10:15
 */

namespace App\Response;

trait AdminRep
{
    public function responseSucc($data = [], $isObject = false)
    {
        $result = [
            'success' => true,
            'message' => '成功',
            'datas' => empty($data) ? ($isObject === true ? (object)[] : []) : $data
        ];
        return response()->json($result);
    }

    public function responseFail($mesg = '',  $data = [])
    {
        $result = [
            'success' => false,
            'message' => empty($mesg) ? "失败" : $mesg,
            'datas' => $data
        ];
        return response()->json($result);
    }

}